<template>
  <div ref="main" style="width: 800px;height: 800px;"></div>
</template>

<script>
import * as echarts from 'echarts'
export default {
  name: "MyBorrowEcharts",
  props:['option'],
  watch:{
    option:{
      deep:true,
      handler(newVal){
        this.echarts.setOption(newVal)
      }
    }
  },
  data() {
    return {
      echarts: null,
    }
  },
  mounted() {
    this.init()
  },
  methods: {
    init() {
      this.echarts = echarts.init(this.$refs.main)
      this.echarts.setOption(this.option)
    }
  },
}
</script>

<style scoped>

</style>